import type { FileItem } from "@/api/file/typing";
import type { State, UploadState } from "@/hook/useUpload/typing";
import type { ButtonProps, UploadProps } from "ant-design-vue";

/**上传控件属性 */
export interface CustomUploadProps {
  /**绑定值 */
  value: string;
  /**控件类型 */
  type: "dialog" | "preview" | "button" | "input";
  /**禁用 */
  disabled?: boolean;
  /**控件大小 */
  size?: ButtonProps["size"];
  /**多文件 */
  multiple?: boolean;
  /**最大文件大小 */
  maxFileSize?: number;
  /**可拖拽上传 */
  draggable?: boolean;
  /**可接收文件类型 */
  accept?: UploadProps["accept"];
  /**最大文件数 */
  maxFileNums?: number;
  /**图片宽度 */
  width?: number;
  /**图片高度 */
  height?: number;
}

export interface Props extends CustomUploadProps {
  /**上传之前 */
  beforeUpload: UploadProps["beforeUpload"];
  /**自定义上传方法 */
  customRequest: UploadProps["customRequest"];
  /**上传状态 */
  uploadState: UploadState;
  /**文件状态 */
  state: State;
  /**删除文件 */
  deleteFile: (fileId: string) => Promise<void>;
  /**下载文件 */
  download: (file: FileItem) => void;
  /**预览文件 */
  handlePreview: (current: number) => void;
}
